﻿<%@ Page Title="Register" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Register.aspx.vb" Inherits="webfinancegdrassign4.Register" %>
 <%--Smart Money Saver -  Project for University of Herts--%>
 <%--Date: 08 Jan 2014--%>   
 <%--Version 1--%>
 <%--Project Brief Description - This is a Smart Money Saver asp.net product using VB.net. It is intended to be used by Smart Money Savers  who want to make and save money and earn a certain amount for themselves--%>
 <%--Program Brief Description - This is the about site program file. It gives you basic text information about what this site is about. --%>

 <%--Update 1 -  08 Jan 2014 - Register.aspx , Update - add a check to see income greater than 100k, Add in User, password, email and type to sms_register--%>
 <%--Update-2 -  12 Jan 2014 - Register.aspx , Update - added a Javascript to check email format, added a cookie to the system for username, general tidy up  Also a redirection to login.aspx--%>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">



    <hgroup class="title">
        <h1><br /></h1> 
        <h1><%: Title %></h1>  
        
<script type="text/javascript">

function checkEmail() {

    var email = document.getElementById('theemailaddress'.value);
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (!filter.test(email)) {
        alert('Please provide a valid email address');
    return false;
 }
}</script>
        
        
             
    </hgroup>
    <p class="text-error">
        <asp:Literal runat="server" ID="ErrorMessage" />
    </p>

    <fieldset class="form-horizontal">

         <legend>Create a new account.</legend>


            <div class="control-group">
                <asp:Label runat="server"  CssClass="control-label">Enter Income</asp:Label>
                <asp:TextBox runat="server" ID="chkincome"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Your Salary is less than 100K" MinimumValue="100000" ControlToValidate="chkincome" Display="Dynamic" MaximumValue="1000000" SetFocusOnError="True" Type="Integer"></asp:RangeValidator> 
            <br />
           </div>


        <div class="control-group">
            <asp:Label runat="server" CssClass="control-label">Email Address</asp:Label>
            <asp:TextBox runat="server"  ID="theemailaddress"></asp:TextBox>
            <input type='submit' name='submit' value="Check Email format" onclick='Javascript:checkEmail();'/>


        </div>
        <div class="control-group">
            <asp:Label runat="server" AssociatedControlID="UserName" CssClass="control-label">User name</asp:Label>
            <div class="controls">
                <asp:TextBox runat="server" ID="UserName" ></asp:TextBox>
            </div>
        </div>
        <div class="control-group">
            <asp:Label runat="server" AssociatedControlID="Password" CssClass="control-label">Password</asp:Label>
            <div class="controls">
                <asp:TextBox runat="server" ID="Password" TextMode="Password" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="Password"
                    CssClass="text-error" ErrorMessage="The password field is required." />
            </div>
        </div>
        <div class="control-group">
            <asp:Label runat="server" AssociatedControlID="ConfirmPassword" CssClass="control-label">Confirm password</asp:Label>
            <div class="controls">
                <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />
                <asp:RequiredFieldValidator runat="server" ControlToValidate="ConfirmPassword"
                    CssClass="text-error" Display="Dynamic" ErrorMessage="The confirm password field is required." />
                <asp:CompareValidator runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                    CssClass="text-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
            </div>
        </div>

             <asp:Button runat="server" OnClick="CreateUser" Text="Register" />
             <asp:TextBox ID="theusername" runat="server" Visible="False"></asp:TextBox>
             <asp:TextBox ID="thereference" runat="server" Visible="False"></asp:TextBox>

    </fieldset>
    
</asp:Content>

